<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="Bookmark" href="/favicon.ico" >
    <link rel="Shortcut Icon" href="/favicon.ico" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="__PUBLIC__/admin/lib/html5shiv.js"></script>
    <script type="text/javascript" src="__PUBLIC__/admin/lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/static/h-ui.admin/css/style.css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="__PUBLIC__/admin/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <script type="text/javascript" src="__PUBLIC__/admin/js/jquery.js"></script>
    <script type="text/javascript" src="__PUBLIC__/admin/js/action.js"></script>
    <title>心意卡列表</title>
    <style>
        .sortable li{
            float: left;
            margin-right: 5px;
            list-style:none
        }
    </style>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 心意卡管理 <span class="c-gray en">&gt;</span> 全部心意卡
</nav>
<div class="page-container">
    <div class="text-c">
        <input type="text" class="input-text" style="width:250px" placeholder="品牌名称" id="name" value="<?php echo $name;?>">
        <button type="button" class="btn btn-success" id="" name="" onclick="product_option(0);"><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
    </div>
    <br>
    <table class="table table-border table-bordered table-bg">
        <thead>
        <tr class="text-c">
            <th width="40">ID</th>
            <th width="80">主题</th>
            <th width="230">心意卡</th>
            <th width="50">状态</th>
            <th width="100">操作</th>
        </tr>
        </thead>
        <tbody id="news_option">
        <volist name='list' id="b">
            <tr  class="text-c">
                <td>{$b.id}</td>
                <td>{$b.name}</td>
                <td class="sortable" brand_id="{$b.id}">
                    <foreach  name="b.brand_image" item="vo">
                        <li image_id="{$vo.id}"><img src="__DATA__/UploadFiles/{$vo.brand_photo}" width="120px" height="80px"></li>
                    </foreach>
                </td>
                <td><if condition="$b.if_show eq 1"><label style="color:green;">出售中</label><else />已下架</if></td>
                <td class="obj_1">
                    <a onclick="saveOrder({$b.id})">保存排序</a> |
                    <if condition="$b.if_show eq 1">
                        <a href="{:U('set_xj')}?id={$b.id}" >下架</a> |
                        <else/>
                        <a href="{:U('set_sj')}?id={$b.id}" >上架</a> |
                    </if>
                    <a href="{:U('add')}?id={$b.id}" >修改</a>
                    | <a onclick="del_id_url2({$b.id})">删除</a>
                </td>
            </tr>
        </volist>
        </tbody>
        <tr >
            <td colspan="10" class="td_2">
                {$page_index}
            </td>
        </tr>
    </table>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="__PUBLIC__/admin/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/admin/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="__PUBLIC__/admin/static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/admin/static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__PUBLIC__/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="__PUBLIC__/admin/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/admin/lib/laypage/1.2/laypage.js"></script>
<script>
    function product_option(page){
        //var brand_name = $('#name').val();
        var obj={
            "brand_name":$("#name").val(),
        }
        var url='?page='+page;
        $.each(obj,function(a,b){
            url+='&'+a+'='+b;
        });
        location=url;
    }

    function del_id_url2(id){
        if(confirm("确认删除吗？"))
        {
            location="{:U('del')}?id="+id;
        }
    }
    function saveOrder (id) {
        var imageOrder = [];
        $("td[brand_id='"+id+"']").children("li").each(function (index, imageDomObject) {
            imageOrder.push({
                image_id : $(imageDomObject).attr('image_id'),
                image_order : index + 1
            })
        })
        $.ajax({
            type: "POST",
            url: "/index.php/Admin/Brand/saveImageOrder.html",
            data: {
                imageOrder : imageOrder
            },
            success: function(res){
                alert('排序已保存');
            }
        });
    }
</script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
    $( function() {
        $(".sortable").sortable();
        $(".sortable").disableSelection();
    } );
</script>
</body>
</html>
